<?php 
$this->breadcrumbs=array(
    'File Manager'=>array('Admin/tools/fileManager'),
);
$asset = Yii::app()->core->AssetUrl.'/elfinder-1.1';
$cs = Yii::app()->clientScript;
$cs->registerCoreScript('jquery.ui');
$cs->registerScriptFile($asset.'/js/elfinder.min.js', CClientScript::POS_BEGIN);
$cs->registerCssFile($asset.'/css/elfinder.css');

$defaultSiteId = FSM::run('Cms.site.getDefault')->id;
$root = Settings::UPLOAD_FOLDER;
//$root = Settings::UPLOAD_FOLDER.'/'.$defaultSiteId;
$rootPath = Yii::getPathOfAlias('webroot').'/'.$root;
if (!file_exists($rootPath))
    @mkdir($rootPath);
?>

<script type="text/javascript" charset="utf-8">
$().ready(function() {
    var f = $('#elfinder').elfinder({
        url : '<?php echo $this->createUrl('/Core/service/command', array('SID'=>'Core.FileManager.cmdConnect', 'root'=>$root, 'rootAlias'=>'Site Root')); ?>',
        lang : 'en',
        docked : true,
        height: 490
    })
});
</script>
<br/>
<div id="elfinder"></div>

